UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4ZFysNRAKMiLiL+Lf4TOc/0Y0r/1+YtX5MIBtNbafpM='
WHERE
key_id = '57ae61b06e385d50618951d19534892051c04400679975b517709b5c1e07a451'
AND (
token = '4ZFysNRAKMiLiL+Lf4TOc/0Y0r/1+YtX5MIBtNbafpM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)