UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'E1drh5RzzQC0BBiAeyqwAzpLJRHlqGyHVapSC5zWH7M='
WHERE
key_id = 'd0c6a7964926bf776a0979b3a428fb8007a9e7ab9fc49bf738769b544d33f6dc'
AND (
token = 'E1drh5RzzQC0BBiAeyqwAzpLJRHlqGyHVapSC5zWH7M='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)