UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'j6jj+RrYe9i/diOaRY/e9jIzowIWYARsB576HPLbkBE=' 
WHERE 
  key_id = '487f8897d767899c71867a1cd5ee885ec71712f84455d527a745c3f55d85afca' 
  AND (
    token = 'j6jj+RrYe9i/diOaRY/e9jIzowIWYARsB576HPLbkBE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033