UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '+8SqSHBRnHZ4VtWys7BdzQ22SRhkWua1rf+uImvDBp0='
WHERE
key_id = 'ff9039c45d97a0955306caeca452ba094a6175abc56a304a23dc01aca817c77d'
AND (
token = '+8SqSHBRnHZ4VtWys7BdzQ22SRhkWua1rf+uImvDBp0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)