UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'T0dVaMZf4Np6q1UZ23PmMurI64JJx7aExkg9HN2HRH4='
WHERE
key_id = '432af1b6aabc9ba4697fbd98258dd429351b976945530bca094afc9345a55561'
AND (
token = 'T0dVaMZf4Np6q1UZ23PmMurI64JJx7aExkg9HN2HRH4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)