UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TwiuI4WlZkeO3L4EUof9OQlo+c3Undb4qJufLkzbyYU='
WHERE
key_id = 'a86e2d3256973b9058acfbf42310eda1a9a7c99dbbd8298304f0a351d316f852'
AND (
token = 'TwiuI4WlZkeO3L4EUof9OQlo+c3Undb4qJufLkzbyYU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)