UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9AfvEAJQFdrgxYTsCvCQssBW1Oh4XYtCu43gOGFhhwM='
WHERE
key_id = 'ceb5b4feb621f99428bd79258d3683c4784ebf8dcd4666cc2cc533c901ee0586'
AND (
token = '9AfvEAJQFdrgxYTsCvCQssBW1Oh4XYtCu43gOGFhhwM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)