UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cA5N3AqUu+SBAiTXMx/yd1zVyUA2ZCR7mloKsWkNxpo='
WHERE
key_id = 'bfa30f8d7cacd387f795ad2b06b37e033cdf91a236ce5678aefa2545a528742c'
AND (
token = 'cA5N3AqUu+SBAiTXMx/yd1zVyUA2ZCR7mloKsWkNxpo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)