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