UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XV37ifsAyX1ByNTmHMzW14bTUs0hSL59hEZiTB9hDkg='
WHERE
key_id = 'bf4cb39e095dab696d2db73787c6ae5ceb46c27dd18222f4cabeb319fc158cf3'
AND (
token = 'XV37ifsAyX1ByNTmHMzW14bTUs0hSL59hEZiTB9hDkg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)