UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nncKAm9t5pCQoi5xQGiDzvX/l+vArYyHM9YXpq9Nd5w=' 
WHERE 
  key_id = 'a5088cc010a32a6bb82e88e5b259003a2c20c2074fbd1d392f1dda5ae98817f6' 
  AND (
    token = 'nncKAm9t5pCQoi5xQGiDzvX/l+vArYyHM9YXpq9Nd5w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038