UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'rZuHastziopNSupafpHQfFg4ivp8DYZqYUkR1ihrc78='
WHERE
key_id = '67f9cd00dfb500a2cffc8de2cf295ec959fe24294e605e2e8d3f91f30f2adc97'
AND (
token = 'rZuHastziopNSupafpHQfFg4ivp8DYZqYUkR1ihrc78='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)