UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NofrPjVzDxGO/Wqew6uyhrqGPE+cTjA8IlKSbTSjrIQ='
WHERE
key_id = 'c58023a140a1dfe61e390e98a1b8e868afe5ca48ec5da2c579e4bbdd06ea33c8'
AND (
token = 'NofrPjVzDxGO/Wqew6uyhrqGPE+cTjA8IlKSbTSjrIQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)