UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'G96ABv0YRY6NnKAhISMBNXtic2XgndDF6Cn5A+WMJi0='
WHERE
key_id = '306676f9cb41f9595bad35b15c57d46523051da12df9f1bde6e18d883c6ed53f'
AND (
token = 'G96ABv0YRY6NnKAhISMBNXtic2XgndDF6Cn5A+WMJi0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)