UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rx8kJe3sPsD9czds60Xk65cDffUYmEtPm6ElUn8aSek=' 
WHERE 
  key_id = '0d23b3e906573ba96eac8371c81e6045ca20b2f93294b4283cdba169fb1df96e' 
  AND (
    token = 'rx8kJe3sPsD9czds60Xk65cDffUYmEtPm6ElUn8aSek=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034