UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4ypq6J6VinvORr8JVu7K0aqFSHXo897Jj7jd3c1lSew='
WHERE
key_id = 'ef693275246d0daf1fd3057177054c39ad6f26e9f29112945a454e94db75f8d8'
AND (
token = '4ypq6J6VinvORr8JVu7K0aqFSHXo897Jj7jd3c1lSew='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)