UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'anYGrzYXNR99oc7LgCTEHMqHH07ZTjvhFbCpxy4Ay44='
WHERE
key_id = 'fce25fe19826212b61153a021d03cd06ec1f129c7185b50fccf2bae100cd7af8'
AND (
token = 'anYGrzYXNR99oc7LgCTEHMqHH07ZTjvhFbCpxy4Ay44='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)