UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'G1aeiBT5EB/92T9GuvUQ+3KxW0gAd7c8OZoM2rrwv+0=' 
WHERE 
  key_id = 'dcf58048e619fe14844b38f7a2a10c405e5151222d722dc97199528f3312fed3' 
  AND (
    token = 'G1aeiBT5EB/92T9GuvUQ+3KxW0gAd7c8OZoM2rrwv+0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00072