UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'eJTSZ7jwzhsDMuSO5IgQCA+7WWdA+zVYAFX2Z2T72tw='
WHERE
key_id = 'c312a71d7d8ba51ceed127abb248e4d9715718fe8908a1f75358b78e738a1322'
AND (
token = 'eJTSZ7jwzhsDMuSO5IgQCA+7WWdA+zVYAFX2Z2T72tw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)