UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'g9z3gRtTmfNwmMFehmugfEAPfTzHvHsNdGppICdukpg='
WHERE
key_id = '6e02d5b55646f29707342cc236ca337f7d8b308ec22d2f751bd536bb2807dc8d'
AND (
token = 'g9z3gRtTmfNwmMFehmugfEAPfTzHvHsNdGppICdukpg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)