UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cAMd0AhPV+D6XnpmT6VkFbCGqA8cznOQ/zX5KCs8SHw='
WHERE
key_id = '29c8451e69a8c90e2d06ea5f0363b8994aa2d71abe13baffb33530ddd88bb813'
AND (
token = 'cAMd0AhPV+D6XnpmT6VkFbCGqA8cznOQ/zX5KCs8SHw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)