UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qpHgGeEw2SWrN9SAEW/iCnKRAOXlp9eglzyslmZzMHY='
WHERE
key_id = 'aa34085052b5b9002ce8e5317bd13825823ac976999fefb095b1548e0da70bcc'
AND (
token = 'qpHgGeEw2SWrN9SAEW/iCnKRAOXlp9eglzyslmZzMHY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)