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