UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XllnuiNLKEExcG0c+GChCckNYCq7KVRxdX14F6Hqbpg=' 
WHERE 
  key_id = 'ca5283d1032ad20ca0af8871026460f65205f73279983c9625f4d3c442992492' 
  AND (
    token = 'XllnuiNLKEExcG0c+GChCckNYCq7KVRxdX14F6Hqbpg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038