UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'oaKEGdPJeH88iPT1x3FqzLCB5JBoSjU1ph2RFs3HocY='
WHERE
key_id = '1cff906d9e1208a8b0086b88a8cc63622e94e1188016d3d7a63931d0f42ca0fb'
AND (
token = 'oaKEGdPJeH88iPT1x3FqzLCB5JBoSjU1ph2RFs3HocY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)