UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'j7LgZHZsdOTVL1Zw4nc0hrO9mm6smrG+KD8h4QTggiM='
WHERE
key_id = 'cdd94a69816118b3979e931d4e80afc1fd0bc9ff43af054158977c0625323ede'
AND (
token = 'j7LgZHZsdOTVL1Zw4nc0hrO9mm6smrG+KD8h4QTggiM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)