UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9iL6lQV4gxp4ZKc1+S3Z3fzr0sz10Ra3grKoiPbI6hg='
WHERE
key_id = 'ade4195764be3b4d62ef392219bef565117b7c101432f242d2e14baf5a30f381'
AND (
token = '9iL6lQV4gxp4ZKc1+S3Z3fzr0sz10Ra3grKoiPbI6hg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)