UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NwX8wrfLUXWo0zsNygDvELEKB7Ou9sx+DO6LvYtKXF0='
WHERE
key_id = '7363d5d5463d2138500b808d603c911cac8703ae76fae2189c0fc7178daa3df1'
AND (
token = 'NwX8wrfLUXWo0zsNygDvELEKB7Ou9sx+DO6LvYtKXF0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)