UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ab7OurpjIa4jRmKZWIOngpc5nxZp9CPqpqCiAUt22Ec=' 
WHERE 
  key_id = 'c30fa5207314431356e37e20d60dd07782c36bcd629d46d11927df9296a5ed79' 
  AND (
    token = 'ab7OurpjIa4jRmKZWIOngpc5nxZp9CPqpqCiAUt22Ec=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038