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