UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CXDvOAycsi1l7jOY9ZbnQTCcpji7oK4KsEO+a+LDidE='
WHERE
key_id = '265c007ada08e5b0256a3d1e22321e4a775148dfb1aaec4c7dbe1def970d16a2'
AND (
token = 'CXDvOAycsi1l7jOY9ZbnQTCcpji7oK4KsEO+a+LDidE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)