UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'V7zYn50TYXTaRzrQPMXl0dyBhvMsFdklitiPwAyydB4='
WHERE
key_id = '440db5d95f569eca7f5e431afb6f112ecd970712d5ab5c93d5777ffe88fad45c'
AND (
token = 'V7zYn50TYXTaRzrQPMXl0dyBhvMsFdklitiPwAyydB4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)