UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Kg9K9MHFF88esRW0yiuHVv60rvu3encYix0LGiDERGk=' 
WHERE 
  key_id = '60a40d4106c8b01ec4e80b40df92f6173562180ffe1ca2bf98e49b029c9b7c6f' 
  AND (
    token = 'Kg9K9MHFF88esRW0yiuHVv60rvu3encYix0LGiDERGk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035