UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hsy1ccXWBQPGN+l/8uNdNWJAv9TwZx4+rrNVHDKFYDc=' 
WHERE 
  key_id = 'fd61d514cca2e840d2054cdeff46156255970347512009f04f722138ec1d9721' 
  AND (
    token = 'hsy1ccXWBQPGN+l/8uNdNWJAv9TwZx4+rrNVHDKFYDc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019