UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'stPJz3vCWEc3nNdYOkFPC41cEEr4uMexOhbpAJfwJ08='
WHERE
key_id = '5d014955eabb558adc0967b353981272421a904f7c8334fc2dea9090514208b4'
AND (
token = 'stPJz3vCWEc3nNdYOkFPC41cEEr4uMexOhbpAJfwJ08='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)