UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wW3mwfNUMj/Vp8ivno/9ZEw/U92aGyr7loahS+IemRo='
WHERE
key_id = 'e3258245e65c301cd769dc721a1fe58a8260851a1c8ae72b547594ec0f58f710'
AND (
token = 'wW3mwfNUMj/Vp8ivno/9ZEw/U92aGyr7loahS+IemRo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)