UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sBKznRt2fVSXpCasZA6zZ/4VJ6BMgeFlw7KKVc22YSw='
WHERE
key_id = 'b61491ffdf4f1435e745864efa9070d2165c999796773ff09a855de13d6b8d24'
AND (
token = 'sBKznRt2fVSXpCasZA6zZ/4VJ6BMgeFlw7KKVc22YSw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)