UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'iIPNOX1rWWrFYFiwgpmr/6O+nUgTsB+jpdIqCb4yJak='
WHERE
key_id = 'ec014a55b7a15fe5239d769ce852ff294e4d36a991e4c1e122c18eda2460ce9a'
AND (
token = 'iIPNOX1rWWrFYFiwgpmr/6O+nUgTsB+jpdIqCb4yJak='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)