UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'w8oGJiUIYknzEEUlYLuvaVE6GLVf+m8VBb6yXyOhPN4='
WHERE
key_id = '38f37a79a3845355c398f6df8639579018015aa953933ef5f0c2de8df4ae4b9a'
AND (
token = 'w8oGJiUIYknzEEUlYLuvaVE6GLVf+m8VBb6yXyOhPN4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)