UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6NvqLaIK2dNPZymHn1pq8uIGVakGtp+vDeddLEe/ZOo='
WHERE
key_id = '99ce310ff787591140ad81764e86fa1bf34073372025930d42059d2f641c7293'
AND (
token = '6NvqLaIK2dNPZymHn1pq8uIGVakGtp+vDeddLEe/ZOo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)