UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9bCSs1ljMCI9QRnuPhhSdHdae02+jukOdx7PPW8W0hE='
WHERE
key_id = '5653f64fcf094047f19e3711db6abee60c1b76f00c108ec02c65e5caa2a5cae0'
AND (
token = '9bCSs1ljMCI9QRnuPhhSdHdae02+jukOdx7PPW8W0hE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)