UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'i+cN8/JcX2mXaUutS3hAWV9kOFLZ0/W+zIoW2QA5f1w='
WHERE
key_id = 'a50b917a3cf9ab1e29e817ac2de0b76e6cb79d8b336eeae09a02eb6f441dedd4'
AND (
token = 'i+cN8/JcX2mXaUutS3hAWV9kOFLZ0/W+zIoW2QA5f1w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)