UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jBwAw/y7kOTyMVeUZOXR5UTRXPj3T5eORSBGOvfBm/8=' 
WHERE 
  key_id = '79bb90372adad60139e9f18e6136fa08700cd4587fdde28c06943303595693b1' 
  AND (
    token = 'jBwAw/y7kOTyMVeUZOXR5UTRXPj3T5eORSBGOvfBm/8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043