UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tmdJ2OAMuAW+sodOIY0Cs6BVBvVBtVgpK5D4Amaqrfs='
WHERE
key_id = '3b7fd9b62048495f701e2b883fbd602343e9d429acf9c911a74a70341575ae76'
AND (
token = 'tmdJ2OAMuAW+sodOIY0Cs6BVBvVBtVgpK5D4Amaqrfs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)