UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '84m2YSatJRrfyAJfc5ntv4TKonFD1v6tQ8ChJXxzS1k='
WHERE
key_id = 'b6b6c27af052d5313df58027e9336ae7cbc7d8dc7a9e63fa1b5a456093a50b90'
AND (
token = '84m2YSatJRrfyAJfc5ntv4TKonFD1v6tQ8ChJXxzS1k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)