UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dwWTsrKyWVM2b5G5gtwyTwlKh7FV0u4prvUIjkFeatw='
WHERE
key_id = '635995d0bd10855885a8e624d2bee5ed953115affb633e4b5389f87e8a1ec8d5'
AND (
token = 'dwWTsrKyWVM2b5G5gtwyTwlKh7FV0u4prvUIjkFeatw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)