UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'g+a379A45FWdTyxdD/gAHehxPTPcjMqVv5vscrcK5js=' 
WHERE 
  key_id = '38ffeadeae387595370fb333b938e2512368380adce94278297ed66daf018afa' 
  AND (
    token = 'g+a379A45FWdTyxdD/gAHehxPTPcjMqVv5vscrcK5js=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044