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