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